﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace PersonalTrener
{
    public partial class picAlarm : Form
    {
       private static picAlarm instance;

       private picAlarm() 
       {
           InitializeComponent();
       }

       public static picAlarm Instance
       {
          get 
          {
             if (instance == null)
             {
                 instance = new picAlarm();
             }
             return instance;
          }
       }

        private static Bitmap MyImage;
        public static void ShowAlarm(string picPath)
        {
            // Sets up an image object to be displayed.
            if (MyImage != null)
            {
                MyImage.Dispose();
            }
            // Stretches the image to fit the pictureBox.
            Instance.alarmPictureBox.SizeMode = PictureBoxSizeMode.StretchImage;
            MyImage = new Bitmap(picPath);
            Instance.alarmPictureBox.ClientSize = new Size(MyImage.Width, MyImage.Height);
            Instance.alarmPictureBox.Image = (Image)MyImage;
            if (!Instance.Visible)
            {
                Instance.Visible = true;
            }
        }

    }
}
